﻿function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function JumpPageAlbumList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.FListAlbum.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divAlbumImagesList").innerHTML = retValue;
}
function JumpPageAlbumListDetails(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
    retValue = SODC.CMPortal.AdvImage.AlbumDetails.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divViewAlbumListContent").innerHTML = retValue;
}
function JumpPageVideoDetail(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript) {
   retValue = SODC.CMPortal.FVideo.FListVideo.GetHtml(TabModuleId, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript).value;
    if (retValue.indexOf("ERROR") != -1) {
        alert(retValue);
        return;
    }
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}
function ClientAddHtml()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Html.Html.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Html.Html.GetHtml(WorkflowStatus,PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHtmlContent").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHtml()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language = document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    Alias = document.getElementById("txtAlias").value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Html.AddHtml.ServerSideAddHtml(belongSite, language, Alias, Subject, bodyText).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHtml(HtmlId)
{
    language = document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    Alias = document.getElementById("txtAlias").value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Html.UpdateHtml.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Html.UpdateHtml.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Html.UpdateHtml.ServerSideHtml(language, HtmlId, Alias, Subject, bodyText).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Html.UpdateHtml.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Html.Html.GetProcessingText().value;
    setTimeout("RealRunFilter()",10);
}


function RealRunFilter()
{
    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
    WorkflowStatus="";
    if(WorkflowStatusIndex!=-1)
    {
        WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    }
    
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Html.Html.GetHtml(belongSite, WorkflowStatus,PageIndex).value;
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHtmlContent").innerHTML=value;
}


function ClientDeleteHtml(HtmlId)
{
    if(confirm(SharepointPortal.WebParts.Html.Html.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Html.Html.ServerSideDeleteHtml(HtmlId).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Html.Html.GetDeleteOkMsg().value);
    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Html.Html.GetHtml(WorkflowStatus,PageIndex).value;
    document.getElementById("divHtmlContent").innerHTML=value;
}

function ShowUpdateHtmlForm(HtmlId)
{
    Url=SharepointPortal.WebParts.Html.Html.GetUpdateHtmlUrl(HtmlId).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
 
    value=SharepointPortal.WebParts.Html.Html.GetHtml(WorkflowStatus,PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHtmlContent").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHtmlBody(HtmlId)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Html.UpdateHtml.GetSubject(language,HtmlId).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Html.UpdateHtml.GetBody(language,HtmlId).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHTML(retValue);
    
}


function ClientPublishingHtml(HtmlId)
{
    if(confirm(SharepointPortal.WebParts.Html.Html.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Html.Html.ServerSidePublishing(HtmlId).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHtml(HtmlId)
{
    if(confirm(SharepointPortal.WebParts.Html.Html.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Html.Html.ServerSideUnPublishing(HtmlId).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Html.Html.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Html.Html.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Html.Html.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
